import {createRouter, createWebHistory} from 'vue-router'
import indexHome from '/src/Views/indexHome.vue'
import Login from '/src/Views/login/login.vue'

// 路由
import dashboard from '/src/Views/dashboard/index.vue'  // 工作台
import organization from '/src/Views/branches/organization.vue' // 机构管理
import institutions from '/src/Views/branches/institutions.vue' // 机构作业范围
import freight from '/src/Views/transit/freight.vue' // 运费管理
import operational from '/src/Views/branches/operational.vue'
import carModels from '/src/Views/transit/carModels.vue' //车型管理
import vehicle from '/src/Views/transit/vehicle.vue' // 车辆列表
import carRegister from '/src/Views/transit/carRegister.vue' // 回车登记
import driver from '/src/Views/transit/driver.vue' // 司机管理
import workArrange from '/src/Views/transit/workArrange.vue' // 排班管理
import orderManage from '/src/Views/business/orderManage.vue'
import waybill from '/src/Views/business/waybill.vue'
import transport from '/src/Views/transport/transport.vue'
import line from '/src/Views/transport/line.vue'
import pickUptask from '/src/Views/branches/pickUptask.vue'
import dispatchTask from '/src/Views/branches/dispatchTask.vue'

const routes = [
    {
        path: '/',
        redirect: '/dashboard'
    },
    {
        name: 'login',
        path: '/login',
        component: Login
    },
    {
        name: 'index',
        path: '/index',
        component: indexHome,
        children: [
            // 工作台菜单
            {
                name: 'dashboard',
                path: '/dashboard',
                component: dashboard
            },
            {
                name: 'business',
                path: '/business',
                children: [
                    {
                        name: 'orderManage',
                        path: '/business/order-manage',
                        component: orderManage
                    },
                    {
                        name: 'waybill',
                        path: '/business/waybill',
                        component: waybill
                    }
                ]
            },
            {
                name: 'branches',
                path: '/branches',
                children: [
                    {
                        name: 'organization-manage',
                        path: '/branches/organization-manage',
                        component: organization
                    },
                    {
                        name: 'institutions-jobs-area',
                        path: '/branches/institutions-jobs-area',
                        component: institutions
                    },
                    {
                        name: 'operational-range',
                        path: '/branches/operational-range',
                        component: operational
                    },
                    {
                        name: 'pickUptask',
                        path: '/branches/pickUptask',
                        component: pickUptask
                    },
                    {
                        name: 'dispatchTask',
                        path: '/branches/dispatchTask',
                        component: dispatchTask
                    }
                ]
            },
            {
                name: 'transit',
                path: '/transit',
                children: [
                    {
                        name: 'car-models',
                        path: '/transit/car-models',
                        component: carModels
                    },
                    {
                        name: 'vehicle',
                        path: '/transit/vehicle',
                        component: vehicle
                    },
                    {
                        name: 'carRegister',
                        path: '/transit/car-register',
                        component: carRegister
                    },
                    {
                        name: 'freight-manage',
                        path: '/transit/freight-manage',
                        component: freight
                    },
                    {
                        name: 'driver',
                        path: '/transit/driver',
                        component: driver
                    },
                    {
                        name: 'workArrange',
                        path: '/transit/workArrange-manage',
                        component: workArrange
                    },
                ]
            },
            {
                name: 'transport',
                path: '/transport',
                children: [
                    {
                        name: 'transport',
                        path: '/transport/transport-task',
                        component: transport
                    },
                    {
                        name: 'line',
                        path: '/transport/line-manage',
                        component: line
                    },
                ]
            }
        ]
    },
]
const router = createRouter({
    history: createWebHistory(),
    routes
})
export default router
